using System.Collections.Generic;
using Autofac;
using BuildBox.Core.BootstrapperTasks;
using BuildBox.Core.Logging;
using BuildBox.Core.Server;
using BuildBox.Core.Server.Adapters;
using BuildBox.Core.Server.Requests;

namespace BuildBox.Core
{
    public class ConfigurationModule : Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterType<RegisterRequests>().As<IBootstrapperTask>().SingleInstance();

            builder.RegisterType<HttpServer>().As<IHttpServer>().InstancePerDependency();
            builder.RegisterType<HttpListenerAdapter>().As<IHttpListenerAdapter>().InstancePerDependency();

            builder.RegisterType<List<Request>>().As<IList<Request>>().SingleInstance();
            builder.RegisterType<BuildBoxConfiguration>().As<IConfiguration>().SingleInstance();
            builder.RegisterType<Log>().As<ILog>().SingleInstance();
        }
    }
}